Determine the concentration of total exosomes throughout pregnancy in WT mated C57/B6 mice. Time points for the study included Virgin (day 1), gestational day (G.D) 5.5, 10.5, 14.5, 17.5 and 1 day post partum (day 20). six animals were used for each of the six time points in the study. A volume of 100ul of plasma was obtained by means of cardiac puncture or deeply anesthetized animals. Plasma exosomes were isolated using the total exosome isolation reagent (ThermoFisher) and resuspended in 30ul of PBS. Samples were then blinded (randomly assigned numbers) and analzed by Nanosight (NS300 Malvern) nanoparticle tracking analysis. For each day of nanosight analysis, one sample from each of the time points was chosen and analyzed by Nanosight. Before and after samples were analyzed, 100nm polystyrene bead standards were analyzed (1:125 in PBS) to determine intra and inter assay variability.
Samples and standards were measured twice by two separate injections (from separate tubes) into the machine. Three, thirty second 30 second videos were recorded and analyzed by Nanosight NTA 3.2 and exported raw data was exported as a .csv file which was minimally processed for easy import into R.
| Gain | Level | Threshold | |
|---|---|---|---|
| Standards | 1 | 11 | 4 |
| Samples | 1 | 12 | 4 |
library(tidyverse)
library(cowplot)
library(broom)
library(pwr)
library(plotly)
library(ggsci)
There are total of three datasets that will be used for this experiment. The raw data from all the samples, the 100nm standards to determine the inter and intra-assay variation as well as the timecourse data that serves as the ‘key’ to identify Sample_ID to the experiment condition.
setwd("~/GitHub/time-course/data")
#setwd("~/Library/Mobile\ Documents/com~apple~CloudDocs/time-course/data")
rawdata <- "revised_MASTER-ExperimentSummary.csv"
timecourse <- "timecourse2017.csv"
standards <- "standards_MASTER-ExperimentSummary.csv"
data <- read_csv(rawdata)
tc <- read_csv(timecourse, na = c("","NA"))
std <- read_csv(standards)
The data is in the classical ‘wide’ format which is easy to understand from a human cognition perspective but we need to make it ‘long’ so it’s easier to process in R.
data1 <- data %>%
gather(Sample,Count,2:256)
# Separate samples by identifiers
data2 <- data1 %>%
separate(Sample, into=c("Sample_ID","Dilution_factor","Injection","Tech_rep", sep = "_")) %>%
select(-`_`)
std1 <- std %>%
gather(Sample,Count,2:82)
std2 <- std1 %>%
separate(Sample, into=c("Sample_ID","When","Dilution_factor","Nano_day","Injection","Tech_Rep", sep = "_")) %>%
select(-`_`)
std2$Sample_ID <- as.factor(std2$Sample_ID)
std2$When <- as.factor(std2$When)
std2$Dilution_factor <- as.numeric(std2$Dilution_factor)
std2$Injection<- as.factor(std2$Injection)
std2$Nano_day <- as.numeric(std2$Nano_day)
Obtain the ‘True_count’ by multiplying the ‘Count’ column by the ‘Dilution factor’
std2 <- std2 %>%
mutate(True_Count=Dilution_factor*Count)
## Warning: package 'bindrcpp' was built under R version 3.4.2
std2$Nano_day <- factor(std2$Nano_day, levels=c('1','2','3','4','5','6','7'))
std2$When <- factor(std2$When, levels=c('before','after'))
std3 <- std2 %>%
group_by(particle_size,Sample_ID,When,Dilution_factor,Nano_day,Injection) %>%
summarise( tech_N = length(True_Count),
tech_mean = mean(True_Count),
tech_sd = sd(True_Count),
tech_se = tech_sd/sqrt(tech_N))
std3
std4 <- std3 %>%
group_by(Nano_day,When,particle_size) %>%
summarise( inj_N = length(tech_mean),
inj_mean = mean(tech_mean),
inj_sd = sd(tech_mean),
inj_se = inj_sd/sqrt(inj_N))
std4
std_day <- std4 %>%
ggplot(aes(x=particle_size,y=inj_mean,color=When))+
geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\n100nm standards")+ #title
labs(color="Condition")+ #Label table title
facet_grid(. ~ Nano_day)
std_day
###Plot facet by when and experimental day
std_day_facet <- std4 %>%
ggplot(aes(x=particle_size,y=inj_mean,color=When))+
geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\n100nm standards")+ #title
labs(color="Condition")+ #Label table title
facet_grid(When ~ Nano_day)
std_day_facet
## Warning: Removed 1000 rows containing missing values (geom_path).
std_df <- std4 %>%
group_by(Nano_day,When) %>%
summarise(total=sum(inj_mean))
std_df
std_bar_plot <- std_df %>%
ggplot(aes(x=Nano_day,y=total,fill=When))+
geom_col(position="dodge")+
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Experimental Day") + # X axis label
ylab("\nMean Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\n100nm standards")+ #title
labs(color="When") #Label table title
std_bar_plot
# ggsave(plot = std_bar_plot, "std_bar_plot.png",
# height = 5, width = 7, dpi = 300, units= "in")
Intra.assay_cv <- std_df %>%
group_by(Nano_day) %>%
summarise(Day_N = length(total),
Day_mean = mean(total),
Day_sd = sd(total),
Day_se = Day_sd/sqrt(Day_N),
Day_cv = Day_sd/Day_mean )
Intra.assay_cv
# write_csv(Intra.assay_cv, "Intra.assay_cv.csv")
Inter.assay <- Intra.assay_cv %>%
summarise(Exp_N = length(Day_mean),
Exp_mean = mean(Day_mean),
Exp_sd = sd(Day_mean),
Exp_se = Exp_sd/sqrt(Exp_N),
Exp_cv = Exp_sd/Exp_mean )
Inter.assay
# write_csv(Inter.assay, "Inter.assay.csv")
# Refactoring Columns for samples
data2$Sample_ID <- as.factor(data2$Sample_ID)
data2$Dilution_factor <- as.numeric(data2$Dilution_factor)
data2$Injection<- as.factor(data2$Injection)
data2$Tech_rep <- as.numeric(data2$Tech_rep)
# Refactoring COlumns for timecourse
tc$Sample_ID <- as.factor(tc$Sample_ID)
tc$Day <- as.factor(tc$Day)
tc$Weight <- as.numeric(tc$Weight)
tc$TEI_Day <- as.factor(tc$TEI_Day)
tc1 <- tc %>%
select(Day:Pups)
tc1
data2 <- data2 %>%
mutate(True_Count=Dilution_factor*Count)
data2
data3 <- data2 %>%
group_by(particle_size,Sample_ID,Dilution_factor,Injection) %>%
summarise( tech_N = length(True_Count),
tech_mean = mean(True_Count),
tech_sd = sd(True_Count),
tech_se = tech_sd/sqrt(tech_N))
data3
test1 <- left_join(tc1,data3, by= "Sample_ID")
data4 <- data3 %>%
group_by(particle_size,Sample_ID,Dilution_factor) %>%
summarise( inj_N = length(tech_mean),
inj_mean = mean(tech_mean),
inj_sd = sd(tech_mean),
inj_se = inj_sd/sqrt(inj_N))
data4
test2 <- left_join(tc1,data4, by= "Sample_ID")
test2
test1$Sample_ID_correct = factor(test1$Sample_ID, levels=c('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','70','73','74','75','76'))
graph1 <- test1 %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nMouse Plasma Throughout Pregnancy")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct, nrow=7)
graph1
Virgin Mice
virgin_histogram <- test1 %>%
filter(Day == '1') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
virgin_histogram
# ggsave(plot = virgin_histogram, "virgin_histogram.png",
# height = 10, width = 14, dpi = 300, units= "in")
GD 5.5
gd5.5_histogram <- test1 %>%
filter(Day == '5') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nGD 5.5 Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
gd5.5_histogram
# ggsave(plot = gd5.5_histogram, "gd5.5_histogram.png",
# height = 10, width = 14, dpi = 300, units= "in")
GD 10.5
gd10.5_histogram <- test1 %>%
filter(Day == '10') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nGD 10.5 Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
gd10.5_histogram
# ggsave(plot = gd10.5_histogram, "gd10.5_histogram.png",
# height = 10, width = 14, dpi = 300, units= "in")
GD 14.5
gd14.5_histogram <- test1 %>%
filter(Day == '14') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nGD 14.5 Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
gd14.5_histogram
# ggsave(plot = gd14.5_histogram, "gd14.5_histogram.png",
# height = 10, width = 14, dpi = 300, units= "in")
GD 17.5
gd17.5_histogram <- test1 %>%
filter(Day == '17') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nGD 17.5 Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
gd17.5_histogram
# ggsave(plot = gd17.5_histogram, "gd17.5_histogram.png",
# height = 10, width = 14, dpi = 300, units= "in")
1 Day Post
one.day.post.partum_histogram <- test1 %>%
filter(Day == '20') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se,
ymax=tech_mean+tech_se),
alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\n1 Day Post Partum Mouse Plasma")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~ Sample_ID_correct)+
geom_vline(xintercept = 140)+
annotate("text", x= 235, y = 4E9, label= "140nm")
one.day.post.partum_histogram
# ggsave(plot = one.day.post.partum_histogram, "one.day.post.partum_histogram.png",
# height = 10, width = 14, dpi = 300, units= "in")
graph2 <- test2 %>%
group_by(TEI_Day) %>%
ggplot(aes(x=particle_size, y=inj_mean,color=Day ))+ #plot
#geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\nMouse Plasma Throughout Pregnancy")+ #title
labs(color="Condition")+ #Label table title
facet_wrap(~ TEI_Day, ncol=7)
graph2
### Particle concentration values for each of the 36 samples
test3 <- test2 %>%
group_by(Day,Sample_ID) %>%
summarise(particle_conc=sum(inj_mean))
test3
# write_csv(test3, "Sample_means.csv")
plot1 <- test3 %>%
group_by(Day) %>%
ggplot(aes(x= Day, y = particle_conc/1E9, color=Day)) +
geom_boxplot(colour="black",fill=NA) +
geom_point(aes(text = paste("Sample ID:", Sample_ID)),
position='jitter',size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy (All Samples)\n")+ #title
labs(color="Condition")+ # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
plot1
# ggsave("Exosome_plot.png", height = 5, width = 7, units = "in", dpi = 600)
We can see that there are outlier values for Virgin, GD 17 and 1 day post. For these box plots, the middle line represents the median (50th percentile), the lower line represents the 25th percentile and the upper line represents the 75th percentile. The whiskers extend from each end of the box and goes to the farthest nonoutlier point. Outliers are values that are greater than 1.5x the interquartile range from either edge of the box. ##Plotly of all values
ggplotly(plot1)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
Samples 6, 26, 32 will be excluded because they are greater than 1.5x the interquartile range. Sample 28 did not have enough blood to be reanalyzed and was thu
plot1 <- test3 %>%
filter(!Sample_ID %in% c('6','26','28','32')) %>%
group_by(Day) %>%
ggplot(aes(x= Day, y = particle_conc, color=Day)) +
geom_boxplot(colour="black",fill=NA) +
geom_point(aes(text = paste("Sample ID:", Sample_ID)),
position='jitter',size=3)+
xlab("Day of Gestation\n") + # X axis label
ylab("\nExosomes/ml\n") + # Y axis label
# ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
#
guides(color=FALSE)+
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Non-Pregnant","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Non-Pregnant","5","10","14","17","1 Day Post")) # Change Legend
plot1
# ggsave("Exosome_plot_new.png", height = 5, width = 7, units = "in", dpi = 600)
ggplotly(plot1)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
test4 <- test3 %>%
filter(!Sample_ID %in% c('6','26','28','32')) %>% #Removing outliers
group_by(Day) %>%
summarise(Day_N=length(particle_conc),
Day_mean = mean(particle_conc),
Day_sd = sd(particle_conc),
Day_se = Day_sd/sqrt(Day_N))
test4
# write_csv(test4,"Summary_statistics_for_each_GD.csv")
plot <- test4 %>%
ggplot(aes(x = Day, y = Day_mean))+ #plot
geom_bar(stat = "identity", color = "Black", width = 0.8)+
geom_errorbar(aes(ymin = Day_mean-Day_se, ymax = Day_mean+Day_se), width=.4,
size = 0.8, colour = "black", position = position_dodge(.9)) + #error bars
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nMean Concentration\n(Vesicles/ml)\n") + # Y axis label
ggtitle("\nMouse Plasma Vesicle Concentration\nAcross Pregnancy\n")+ #title
guides(fill=FALSE) + # Remove legend
scale_y_continuous(breaks = seq(1E11,5E11,1E11),
limits = c(0,5E11),
expand=c(0,0))+ #set bottom of graph
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Rename bottom
plot
ggsave("Vesicle_barplot.png", height = 5, width = 7, units = "in", dpi = 600)
test7 <- test3 %>%
left_join(tc1)
## Joining, by = c("Day", "Sample_ID")
plot2 <- test7 %>%
ggplot(aes(x = Day, y = particle_conc, color = Day, shape=TEI_Day))+
geom_point(position= 'dodge',size=4)+
scale_shape_manual(values=c(15,16,17,18,22,23,24,1))+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nMean Concentration\n(Vesicles/ml)\n") + # Y axis label
ggtitle("Mouse Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition") + # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post"))
plot2
ggplotly(plot2)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
## Warning: Width not defined. Set with `position_dodge(width = ?)`
tidy(shapiro.test(test3$particle_conc))
p value >0.05 therefore conclude data is normally distributed
jacob <- test3 %>% # Datset without outliers
filter(!Sample_ID %in% c('6','26','28','32'))
# ANOVA
ANOVA <- aov(particle_conc ~ Day, data=jacob)
ANOVA %>%
tidy()
Statistically significant, thus Tukey’s HSD post hoc analysis can determine significant differences.
tukey <- TukeyHSD(ANOVA)
tidy_tukey <- tukey %>%
tidy()
tidy_tukey
tidy_tukey %>%
filter(adj.p.value<0.05) %>%
arrange(adj.p.value)
nano_140 <- data4 %>%
filter(particle_size<140.5) %>%
left_join(tc1, by= "Sample_ID") %>%
group_by(Day,Sample_ID) %>%
summarise(particle_conc=sum(inj_mean)) %>%
filter(!Sample_ID %in% c('6','26','28','32'))
nano_140_plot <- nano_140 %>%
ggplot(aes(factor(Day),particle_conc, color=Day)) +
geom_boxplot(colour="black",fill=NA) +
geom_point(aes(text = paste("Sample ID:", Sample_ID)),
position='jitter',size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nMean Exosome Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("\nExosome Concentration\nAcross Pregnancy\n")+ #title
guides(fill=FALSE) + # Remove legend
scale_y_continuous(breaks = seq(1E11,5E11,1E11),
limits = c(0,5E11),
expand=c(0,0))+ #set bottom of graph
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Rename bottom
nano_140_plot
ggplotly(nano_140_plot)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
nano_140_bar <- nano_140 %>%
group_by(Day) %>%
summarise(N = length(particle_conc),
mean = mean(particle_conc),
sd = sd(particle_conc),
se = sd/sqrt(N)) %>%
ggplot(aes(x= factor(Day),y = mean, fill=Day)) +
geom_col()+
geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=.5,
size=0.8, colour="black", position=position_dodge(.9)) + #error bars
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("\nPlasma Exosome Concentration\nAcross Pregnancy\n")+ #title
guides(fill=FALSE) + # Remove legend
scale_y_continuous(breaks = seq(1E11,5E11,1E11),
limits = c(0,4E11),
expand=c(0,0))+ #set bottom of graph
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Rename bottom
nano_140_bar
ggsave("Exosome_barplot.png", height = 5, width = 7, units = "in", dpi = 600)
tidy(shapiro.test(nano_140$particle_conc))
p value >0.05 therefore conclude data is normally distributed
exo_fit <- aov(particle_conc ~ Day, data=nano_140)
exo_stats <- tidy(exo_fit)
exo_stats
Statistically significant, thus Tukey’s HSD post hoc analysis can determine significant differences.
exo_HSD <- TukeyHSD(exo_fit)
exo_tukey <- tidy(exo_HSD)
exo_tukey
exo_tukey %>%
filter(adj.p.value<0.05) %>%
arrange(adj.p.value)
test8 <- test7 %>%
filter(!Day == "20" & !Sample_ID == '70')
fit <- lm(particle_conc ~ Weight ,data = test8)
summary(fit)
##
## Call:
## lm(formula = particle_conc ~ Weight, data = test8)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.613e+11 -7.290e+10 -3.068e+10 9.558e+10 2.215e+11
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.154e+10 9.155e+10 0.344 0.7327
## Weight 9.357e+09 3.537e+09 2.646 0.0125 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.176e+11 on 32 degrees of freedom
## Multiple R-squared: 0.1795, Adjusted R-squared: 0.1539
## F-statistic: 7.001 on 1 and 32 DF, p-value: 0.01253
tidy(summary(fit))
test7 %>%
ggplot(aes(x= Weight, y = particle_conc))+
geom_point()+
geom_smooth()+
xlab("\nWeight (g)\n") + # X axis label
ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("Linear Regression of Exosome \nConcentration vs. Weight")+ #title
labs(color="Day")#Label table title
## `geom_smooth()` using method = 'loess'
test7 %>%
filter(!Sample_ID == '70') %>%
ggplot(aes(x= Weight, y = particle_conc))+
geom_point(size = 3,aes(color=factor(Day)))+
geom_smooth(method = "lm", level = 0.95)+
xlab("\nWeight (g)\n") + # X axis label
ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("Linear Regression of Exosome \nConcentration vs. Weight")+ #title
labs(color="Day")#Label table title
test7 %>%
ggplot(aes(x= Pups, y = particle_conc))+
geom_point(size = 3,alpha = 0.5, aes(color=factor(Day)))+
geom_smooth(method = "lm", level = 0.95)+
scale_x_continuous(limits=c(0,13),
breaks=seq(0,14,2))+
# scale_y_continuous(limits = c(0,5E11),
# expand=c(0,0))+
xlab("\nNumber of Pups\n") + # X axis label
ylab("\nMean Exosome Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("Linear Regression of Exosome \nConcentration vs. Number of Pups")+ #title
labs(color="Day")#Label table title
weight_vs_pup_plot <- test7 %>%
ggplot(aes(x= Pups, y = Weight))+
geom_point(size = 5,alpha = 0.5, aes(color=factor(Day)))+
geom_smooth(method = "lm", level = 0.95)+
scale_x_continuous(limits=c(0,13),
breaks=seq(0,14,2))+
# scale_y_continuous(limits = c(0,5E11),
# expand=c(0,0))+
xlab("\nNumber of Pups\n") + # X axis label
ylab("\nMouse Weight (g)\n") + # Y axis label
ggtitle("Linear Regression of Weight vs. Number of Pups by Gestational Day")+ #title
facet_wrap(~Day)+
labs(color="Day")#Label table title
weight_vs_pup_plot <- weight_vs_pup_plot + scale_color_npg()
# ggsave(plot = weight_vs_pup_plot, "weight_vs_pup_plot.png",
# height = 5, width = 7, dpi = 600, units= "in")
lm(particle_conc~Pups, test7) %>%
summary()
##
## Call:
## lm(formula = particle_conc ~ Pups, data = test7)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.178e+11 -6.519e+10 -1.749e+10 6.978e+10 3.008e+11
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.894e+11 3.929e+10 4.821 2.2e-05 ***
## Pups 1.158e+10 5.331e+09 2.172 0.036 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.178e+11 on 39 degrees of freedom
## Multiple R-squared: 0.1079, Adjusted R-squared: 0.08508
## F-statistic: 4.72 on 1 and 39 DF, p-value: 0.03596
lm(particle_conc~Weight, test7) %>%
summary()
##
## Call:
## lm(formula = particle_conc ~ Weight, data = test7)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.569e+11 -6.405e+10 -1.877e+10 8.546e+10 2.257e+11
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.407e+10 7.044e+10 0.342 0.73444
## Weight 9.450e+09 2.683e+09 3.522 0.00111 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.086e+11 on 39 degrees of freedom
## Multiple R-squared: 0.2413, Adjusted R-squared: 0.2219
## F-statistic: 12.4 on 1 and 39 DF, p-value: 0.001109
lm(Weight~Pups, test7) %>%
summary()
##
## Call:
## lm(formula = Weight ~ Pups, data = test7)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.1404 -3.8750 -0.1288 2.1760 16.5593
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 18.8688 1.8004 10.480 6.66e-13 ***
## Pups 1.0152 0.2443 4.156 0.000171 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.398 on 39 degrees of freedom
## Multiple R-squared: 0.3069, Adjusted R-squared: 0.2891
## F-statistic: 17.27 on 1 and 39 DF, p-value: 0.0001715
model <- test7 %>%
group_by(Day) %>%
nest %>%
mutate(weight_pups = map(data, ~lm(Weight~Pups, data = .)),
part_pups = map(data, ~lm(particle_conc~Pups, data = .)),
part_weight = map(data, ~lm(particle_conc~Weight, data = .))) %>%
ungroup()
finished_model <- model %>%
gather(comparison,model,3:5) %>%
mutate(model_glance = map(model, glance),
model_tidy = map(model, tidy)) %>%
unnest(model_glance) %>%
group_by(comparison) %>%
arrange(desc(adj.r.squared))
finished_model
mean_placenta <- tc %>%
#filter(Day %in% c('10','14','17') & !Sample_ID %in% c('70','73','74','75')) %>%
select(-(TEI_Day:Pup_right),-Resorp) %>%
gather("Placenta_avg","Plac_weight", 3:5) %>%
group_by(Day,Sample_ID) %>%
summarise(N = length(Plac_weight),
mean_plac = mean(Plac_weight*1000, na.rm = TRUE), #convert g to mg
sd = sd(Plac_weight)*1000, #convert g to mg
se = sd/sqrt(N))
plasma_exo_vs_weight_plot <- mean_placenta %>%
inner_join(test7) %>%
filter(Day %in% c(10,14,17)) %>%
ggplot(aes(x= mean_plac, y = particle_conc))+
geom_point(size= 3,aes(color=factor(Day)))+
geom_smooth(method = "lm", level = 0.95)+
scale_x_continuous(limits=c(0,120))+
scale_y_continuous(limits = c(0,5.5E11),
expand=c(0,0)) +
facet_wrap(~Day)+
xlab("\nPlacental Weight (mg)\n") + # X axis label
ylab("\nMean Exosome Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("Plasma Exosome Concentration vs. Placental Weight\n Throughout Pregnancy\n")+ #title
labs(color="G.D.")#Label table title
## Joining, by = c("Day", "Sample_ID")
## Warning: Column `Sample_ID` joining factor and character vector, coercing
## into character vector
# plac_weight <- mean_placenta %>%
# inner_join(test7) %>%
# filter(Day %in% c('10','14','17'))
plasma_exo_vs_weight_plot +
scale_color_npg()
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
gd14.5_plot <- mean_placenta %>%
inner_join(test7) %>%
filter(!Day == "1") %>%
filter(Day == "14") %>%
ggplot(aes(x = Pups, y = particle_conc))+
geom_point(size = 5,alpha = 0.5,aes(color=factor(Day)))+
geom_smooth(method = "lm", se= FALSE, color = "Blue")+
# facet_wrap(~Day)+
scale_x_continuous(limits=c(1,12),
breaks=seq(2,12,2))+
scale_y_continuous(limits = c(0,5.5E11),
expand=c(0,0)) +
xlab("\nNumber of Pups\n") + # X axis label
ylab("\nMean Exosome Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("GD14.5 Linear Regression \nExosome Concentration vs. Number of Pups")+ #title
guides(color=FALSE)
## Joining, by = c("Day", "Sample_ID")
## Warning: Column `Sample_ID` joining factor and character vector, coercing
## into character vector
gd14.5_plot
# ggsave(plot = gd14.5_plot, "gd14.5_plot.png",
# height = 5, width = 7, dpi = 600, units= "in")
GD14 <- mean_placenta %>%
inner_join(test7) %>%
filter(Day == "14")
## Joining, by = c("Day", "Sample_ID")
## Warning: Column `Sample_ID` joining factor and character vector, coercing
## into character vector
lm(particle_conc~Pups, GD14 ) %>%
summary()
##
## Call:
## lm(formula = particle_conc ~ Pups, data = GD14)
##
## Residuals:
## 1 2 3 4 5 6
## -5.553e+10 9.503e+10 6.346e+10 5.351e+10 -9.320e+09 -1.593e+11
## 7
## 1.219e+10
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.154e+11 7.885e+10 4.000 0.0103 *
## Pups 1.135e+10 1.047e+10 1.084 0.3279
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.448e+10 on 5 degrees of freedom
## Multiple R-squared: 0.1903, Adjusted R-squared: 0.0283
## F-statistic: 1.175 on 1 and 5 DF, p-value: 0.3279
test3 %>%
filter(!Day %in% c('1','20')) %>%
group_by(Day) %>%
ggplot(aes(factor(Day),particle_conc, color=Day)) +
geom_point(size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition")#Label table title
nanosight_plot <- test1 %>%
filter(Sample_ID == '75') %>%
ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
geom_ribbon(aes(ymin=tech_mean-tech_se, ymax=tech_mean+tech_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0))+ #set bottom of graph
xlab("Particle Size (nm)") + # X axis label
ylab("\nMean Concentration\n(Particles/ml)\n") + # Y axis label
ggtitle("Nanosight Histogram of\n100nm Bead Standards")+ #title
labs(color="Injection")+ #Label table title
facet_wrap( ~Injection)
nanosight_plot
## Warning: Removed 1000 rows containing missing values (geom_path).
# ggsave("Nanosight_plot.png", height = 5, width = 7, units = "in", dpi = 600)
test3 %>%
filter(!Sample_ID %in% c('1','6','15','16','19','24','29','6','28','32')) %>%
group_by(Day) %>%
ggplot(aes(x= Day, y = particle_conc, color=Day)) +
geom_boxplot(colour="black",fill=NA) +
geom_point(aes(text = paste("Sample ID:", Sample_ID)),
position='jitter',size=3)+
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
labs(color="Condition")+ # Label table title
scale_x_discrete(breaks=c("1","5","10","14","17","20"), # Change X axis label
labels=c("Virgin","5","10","14","17","1 Day Post")) +
scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
## Warning: Ignoring unknown aesthetics: text
filtered_data <- test3 %>%
filter(!Sample_ID %in% c('1','6','15','16','19','24','29','6','28','32'))
filtered_fit <- aov(particle_conc ~ Day, data=filtered_data)
filtered_stats <- tidy(filtered_fit)
filtered_stats
filtered_HSD <- TukeyHSD(filtered_fit)
filtered_tukey <- tidy(filtered_HSD)
filtered_tukey %>%
filter(adj.p.value < 0.05) %>%
arrange(adj.p.value)
mean_placenta %>%
group_by(Day) %>%
summarise(mean_N = length(mean_plac),
day_mean = mean(mean_plac),
day_sd = sd(mean_plac),
day_se = day_sd/sqrt(mean_N)) %>%
ggplot(aes(x = Day, y = day_mean, fill = Day))+
geom_bar(stat="identity")+
geom_errorbar(aes(ymin = day_mean-day_se, ymax = day_mean+day_se), width=.5,
size=0.8, colour="black", position=position_dodge(.9)) + #error bars
scale_y_continuous(breaks = seq(0,125,25),
limits = c(0,125),
expand = c(0,0))+ #set bottom of graph and scale
xlab("\nDay of Gestation\n") + # X axis label
ylab("\nWeight (mg)\n") + # Y axis label
ggtitle("Mouse Placental Weight\nThroughout Pregnancy\n")+ #title
labs(fill="Gestational Day") # Label table title
## Warning: Removed 5 rows containing missing values (position_stack).
## Warning: Removed 5 rows containing missing values (geom_errorbar).
ASRI_plot <- test2 %>%
filter(Sample_ID %in% c("2","70")) %>%
ggplot(aes(x = particle_size, y = inj_mean, color = Sample_ID))+
# geom_ribbon(aes(ymin=inj_mean-inj_se,
# ymax=inj_mean+inj_se),
# alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
geom_line(size=2.0) + xlim(0,500)+ #line size, x-axis scale
scale_y_continuous(expand=c(0,0), limits = c(0,8.5E9))+ #set bottom of graph
xlab("Particle Size (nm)") + # X axis label
ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
# ggtitle("Nanosight Histogram of Mouse \nPlasma During Pregnancy")+ #title
labs(color="")+ #Label table title
# scale_color_discrete(labels = c("Virgin","GD14.5"))+
scale_color_npg(labels = c("Non-pregnant","GD14.5"))+
guides(color = guide_legend(reverse = TRUE))+
theme(legend.position = c(.85,.4))
# ggsave(plot = ASRI_plot, "nanosight_sample_plot.png",
# height = 5, width = 7, dpi = 600, units= "in")